package com.dynamic.mybatis.bootstrap.handler;

import com.dynamic.mybatis.core.datasource.DataSourceProperty;
import com.dynamic.mybatis.core.intercept.DynamicDataSourceHandler;
import com.dynamic.mybatis.core.intercept.DynamicSqlSessionHandler;
import com.dynamic.mybatis.core.metadata.DynamicMappedStatement;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.util.Map;

/**
 * @Description
 * @Author xs
 * @Date 2023/5/23 13:28
 */
@Component
public class MyDataSourceHandler implements DynamicDataSourceHandler {

    @Override
    public void before(OPERATE operate, Object dataSourceKey, DataSource dataSource, DataSourceProperty property, Map<Object, Object> attributes) {
       System.err.println("before dataSource handle.   " + dataSourceKey);
    }

    @Override
    public void after(OPERATE operate, Object dataSourceKey, DataSource dataSource, DataSourceProperty property, Map<Object, Object> attributes) {
        System.err.println("after dataSource handle.    " + dataSourceKey);
    }
}